class MyBlock {
    
    /**
     * @returns {String} 返回html对象
     */
    rawBlock(n) {
        if (n >= 5 && n<20) {
            if (dangwei == 1) {
                blockofcolor = this.colorShow();
                dangwei ++;
            }
        }
        if (n >= 20 && n<35) {
            if (dangwei == 2) {
                blockofcolor = this.colorShow();
                dangwei ++;
            }
        }
        if (n >= 35 && n<50) {
            if (dangwei == 3) {
                blockofcolor = this.colorShow();
                dangwei ++;
            }
        }
        if (n >=50 && n<65) {
            if (dangwei == 4) {
                blockofcolor = this.colorShow();
                dangwei ++;
            }
        }
        if (n >= 65 && n<80) {
            if (dangwei == 5) {
                blockofcolor = this.colorShow();
                dangwei ++;
            }
        }
        if (n >=80 && n<95) {
            if (dangwei == 6) {
                blockofcolor = this.colorShow();
                dangwei ++;
            }
        }
        if (n >= 95) {
            blockofcolor = this.colorShow();
        }
        let arr = ['<div></div>',`<div data-key="hei" style="background-color: ${blockofcolor};" ></div>`,'<div></div>','<div></div>'];
        
        let list = arr.sort(function(a,b){
            return Math.random()-0.5;
        })
        
        let html = `
        <div class="div1">
            ${list[0]}
            ${list[1]}
            ${list[2]}
            ${list[3]}
        </div>
        `
        return html;
    }


    /**
     * 获取随机出来的rgb
     * @returns 返回随机数的rgb
     */
    colorShow() {
        let colornub = Math.round(Math.random()*240);
        let colornub2 = Math.round(Math.random()*240);
        let colornub3 = Math.round(Math.random()*240);
        return `rgb(${colornub}, ${colornub2}, ${colornub3})`;
    }

}
